﻿using ServerCommon.Architecture;
using ServerCommon.Log;

namespace GatewayServer
{
    public class Program
    {
        public const string AppName = "GatewayServer";
        public const string Log4NetName = "/GatewayLog4net.xml";

        static void Main(string[] args)
        {
            string ConfigPath = CommandLineHelper.GetOption(args, 0, "../../../../../Configs");
            string serverId = CommandLineHelper.GetOption(args, 1, "1010");

            string logConfigFile = ConfigPath + Log4NetName;
            LogHelper.Init(logConfigFile, true, "./Log", AppName);

            ProgramGatewayServer.Instance?.Init(ProgramServerType.Gateway, AppName, ConfigPath, long.Parse(serverId));

            ProgramGatewayServer.Instance?.Run();

            ProgramGatewayServer.Instance?.Release();

            LogHelper.Release();
        }
    }
}
